package com.xlh.dto.course;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xlh.dto.system.IconDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.util.List;

/**
 * 课程信息
 * <p>
 * Created by lx on 2019/2/22 0022.
 */
@Data
public class CourseIndexInfoDTO implements IconDTO {

    @ApiModelProperty(value = "课程id")
    private Long id;

    @JsonIgnore
    @ApiModelProperty(value = "课程基本id")
    private Long courseBasicId;

    @ApiModelProperty(value = "课程名称")
    private String name;

    @JsonIgnore
    @ApiModelProperty(value = "课程类型")
    private Integer type;

    @JsonIgnore
    @ApiModelProperty(value = "课程图标")
    private Integer icon;

    @ApiModelProperty(value = "课程图标路径")
    private String iconPath;

    @JsonIgnore
    @ApiModelProperty(value = "教师id")
    private Long userId;

    @JsonIgnore
    @ApiModelProperty(value = "教师id的集合")
    private List<Long> userIds;

    @ApiModelProperty(value = "教师姓名集合")
    private List<String> userNames;

    @ApiModelProperty(value = "是否已学习 true：已学习 false：未学习")
    private Boolean studied = false;

    @ApiModelProperty(value = "是否是自己的课程 true：是 false：否")
    private Boolean ownCourse = false;

    @ApiModelProperty(value = "是否可以添加班级 true：是 false：否")
    private boolean created = true;

    @JsonIgnore
    @ApiModelProperty(value = "是否预置 true：预置 false：非预置")
    private Boolean preseted;

    @ApiModelProperty(value = "状态")
    private Integer status;

    @ApiModelProperty(value = "状态 3:未购买")
    private String statusValue;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        CourseIndexInfoDTO that = (CourseIndexInfoDTO) o;

        return new EqualsBuilder()
                .append(courseBasicId, that.courseBasicId)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(courseBasicId)
                .toHashCode();
    }

}
